*===============================================================================
* Do-file creates "Experimental Dataset: Treatment Effects by Violence Expectations - Robustness"
* Appendix Table A11
*===============================================================================

clear 
set more off

cd "~/Dropbox/VFD/REStat_Native_Files/Stata_Files"
local output "~/Dropbox/VFD/REStat_Native_Files/Stata_Files/Output"

use cadg_master_NATIVE.dta, clear


xi: xtreg cumbalance treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post treat_post_anyshock t0_anyshock post_anyshock anyshock i.ym if sample_cash_outlier==0, cl(employeenumber) fe i(employeenumber)
est store col1
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"

xi: xtreg cumbalance treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post treat_post_salaryproblem t0_salaryproblem post_salaryproblem salaryproblem i.ym if sample_cash_outlier==0, cl(employeenumber) fe i(employeenumber)
est store col2
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"

xi: xtreg cumbalance treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post treat_post_low_salarysatis t0_low_salarysatis post_low_salarysatis low_salarysatis i.ym if sample_cash_outlier==0, cl(employeenumber) fe i(employeenumber)
est store col3
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"

xi: xtreg cumbalance treat_post treat_post_v34 post_v34 treat_final t0_v34 violence_34 post treat_post_low_governmentcontrol t0_low_governmentcontrol post_low_governmentcontrol low_governmentcontrol i.ym if sample_cash_outlier==0, cl(employeenumber) fe i(employeenumber)
est store col4
estadd ysumm, mean prefix(in_sample_)
estadd local samplestr "All"
estadd local monthFE "YES"
estadd local stratumFE "-"
estadd local individFE "YES"


estout col1 col2 col3 col4, cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) ///
starlevels(* .1 ** .05 *** .01) style(tex) keep(treat_post treat_post_v34 treat_post_anyshock treat_post_salaryproblem treat_post_low_salarysatis treat_post_low_governmentcontrol) ///
stats(samplestr in_sample_mean N_clust N r2 monthFE individFE, fmt(0 2 0 0 2 0 0) label("Sample" "Mean Dep Var" "\# Employees" "\# Observations" "R-Squared" "Month FE" "Employee FE")) ///
label title("Violence Expectations - Robustness") 

esttab col1 col2 col3 col4 using "`output'/table_a11.tex", cells(b(fmt(%9.2f) star) se(par fmt(%9.2f))) ///
starlevels(* .1 ** .05 *** .01) style(tex) keep(treat_post treat_post_v34 treat_post_anyshock treat_post_salaryproblem treat_post_low_salarysatis treat_post_low_governmentcontrol) ///
stats(samplestr in_sample_mean N_clust N r2 monthFE individFE, fmt(0 2 0 0 2 0 0) label("Sample" "Mean Dep Var" "\# Employees" "\# Observations" "R-Squared" "Month FE" "Employee FE")) ///
label title("Violence Expectations - Robustness") replace

